FROM alpine:latest as builder
WORKDIR /root
RUN apk add --no-cache git make build-base && \
    git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git && \
    cd vlmcsd && \
    make

# RUN apk add --no-cache git make build-base 
# RUN git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git 
# RUN cd vlmcsd && make

# FROM alpine:latest
FROM httpd:alpine
COPY start.sh /root/start.sh
COPY src/ /usr/local/apache2/htdocs/
COPY --from=builder /root/vlmcsd/bin/vlmcsd /vlmcsd
RUN apk add --no-cache tzdata && \
    chmod u+x /root/start.sh 

EXPOSE 80/tcp
EXPOSE 1688/tcp

WORKDIR /bin
CMD ["/root/start.sh"]
# CMD ["httpd-foreground"]
# CMD [ "/root/vlmcsd/bin/vlmcsd", "-D", "-d" ]
# CMD ["/vlmcsd", "-D", "-d", "-t", "3", "-e", "-v"]
